<?php

namespace IDock\Insurance\DEMO\Response;

use IDock\Http\Response;
use IDock\Printer\VehicleModelPrinter;
use IDock\Printer\VehiclePrinter;

class BVehicleModelResponse extends AllDEMOResponse
{

    /*** @var VehicleModelPrinter $printer */
    public $printer = VehicleModelPrinter::class;

    public function printerInit(): Response
    {
        $modelList = $this->get('list');

        if (!$modelList) {
            return $this;
        }

        foreach ($modelList as $datum) {

            $vehiclePrinter = new VehiclePrinter();
            $vehiclePrinter->vehicleModelCode = $datum['modelCode'] ?? '';
            //

            $this->printer->setModelList($vehiclePrinter);
        }

        return $this;
    }
}
